package com.activiti.flow.service;

import com.activiti.basic.exception.ApprovalException;
import com.activiti.flow.model.vo.ProcessDefinitionVO;
import com.activiti.flow.model.vo.ProcessInstanceVO;
import com.activiti.flow.model.vo.RejectTaskVO;
import org.activiti.engine.runtime.ProcessInstance;

import java.util.Map;

/**
 * @author pisory
 * @version 1.0
 * @date 2020/4/6
 */
public interface ProcessInstanceService {

    /**
     * 启动流程
     * @param vo
     * @return
     */
    ProcessInstance startProcessByKey(ProcessDefinitionVO vo) throws Exception;

    /**
     * 通过
     * @param vo
     * @return
     */
    int pass(ProcessInstanceVO vo) throws ApprovalException;

    /**
     * 退回
     * @param vo
     * @return
     */
    void reject(RejectTaskVO vo) throws ApprovalException;

    /**
     * 取消
     * @param vo
     * @return
     */
    void cancel(ProcessInstanceVO vo) throws ApprovalException;

    /**
     * 委托/转办
     * @param vo
     * @throws ApprovalException
     */
    void entrust(ProcessInstanceVO vo) throws ApprovalException;
}
